#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: KevinQi
@file: jtask.py
@time: 2023/12/27 10:47
@desc: 
"""

from backend.conf import config
from backend.workjob.utils.mysql_base import SqlAlBase, MysqlBase
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Float, Text

from backend.workjob.utils.model_utils import ModelBase, ModelExtraBase
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Float, BigInteger


class Task(ModelExtraBase, SqlAlBase.base):
    """
    工作Task任务
    """
    __tablename__ = config.table_prefix + 'task'
    content = Column(Text, nullable=False, unique=False, comment="任务内容")
    start_time = Column(Integer, default=0, nullable=False, comment="task开始时间(hour)")
    end_time = Column(Integer, default=0, nullable=False, comment="task结束时间(hour)")
    exec_date = Column(String(30), nullable=False, comment="任务所属当天日期(yyyy-mm-dd)")
    audit_is_need = Column(Integer, default=1, nullable=False, comment="0:无需审核 1:需审核")
    audit_status = Column(Integer, default=0, nullable=False, comment="0:未审核 1:已审核")
    audit_reject_reason = Column(Text, nullable=True, unique=False, comment="审核不通过原因")
    audit_user_id = Column(Integer, default=0, nullable=True, comment="审核人ID")
    status = Column(Integer, default=0, nullable=False, comment="0:未完成 1：已完成 2:部分完成")
    user_id = Column(BigInteger, nullable=False, comment="task分配人ID")

    def __repr__(self):
        return self.id
